<?php
/**
 * Created by PhpStorm.
 * User: Monkey
 * Date: 2021/10/13
 * Time: 11:27
 * Desc: 登陆
 */

namespace app\backend\validate;

use think\Validate;

class RoleValidate extends Validate
{
    protected $rule = [
        'page' => 'integer',
        'limit' => 'integer',
        'role_name' => 'require|max:30',
        'role_desc' => 'max:100',
        'id' => 'require|integer',
        'menu_ids' => 'require',
        'status' => 'require|in:0,1',
    ];

    protected $message = [
        'page.integer' => '页码格式错误',
        'limit.integer' => '条数格式错误',
        'role_name.require' => '角色名不能为空',
        'role_name.max' => '角色名最多30个字符',
        'role_desc.max' => '描述最多100个字符',
        'id.require' => 'ID不能为空',
        'id.integer' => 'ID格式错误',
        'menu_ids.require' => '菜单ID不能为空',
        'status.require' => '状态不能为空' ,
        'status.in' => '状态格式错误'
    ];

    protected $scene = [
        'index' => ['page','limit'],
        'add' => ['role_name','role_desc'],
        'edit' => ['id','role_name','role_desc'],
        'auth' => ['id','menu_ids'],
        'editStatus' => ['id','status']
    ];
}
